unit convhp1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, DBTables, Grids, DBGrids, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    DataSource1: TDataSource;
    DataSource2: TDataSource;
    DBGrid1: TDBGrid;
    DBGrid2: TDBGrid;
    hpdbf: TTable;
    hpdb: TTable;
    hpdbCodigo: TFloatField;
    hpdbNome: TStringField;
    hpdbfCODIGO: TSmallintField;
    hpdbfHISTOR: TStringField;
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
codigo : string;
begin
hpdb.close;
hpdb.exclusive := true;
hpdb.emptytable;
hpdb.open;
hpdbf.open;
hpdbf.First;
while not hpdbf.Eof do
begin
hpdb.Append;
hpdbcodigo.Value := hpdbfcodigo.Value;
hpdbnome.Value   := hpdbfhistor.value;
hpdb.Post;
hpdbf.Next;
end;
hpdb.First;
hpdbf.First;

end;

end.
